<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>循环的跳出</title>
  </head>
  <body>
    <script>
      // let index = 0
      // while(index < 10) {
      //     console.log(`吃包子第${index}个`);
      //     if(index == 5){
      //         console.log('不吃了撑了');
      //         break
      //     }
      //     index++
      // }
      for (let index = 0; index < 10; index++) {
        console.log(`吃包子第${index}个`);
        if (index == 5) {
          console.log("不吃了撑了");
          continue; //跳出本次循环，继续下次循环
          break; //直接跳出循环
        }
      }
    </script>
  </body>
</html>
